#include <iostream>
#include <string>
#include "contacts.pb.h"

int main()
{
    contacts::student con;

    con.set_id(54);
    con.set_name("萧点");
    con.set_scope(66.6);

    std::string str = con.SerializeAsString();

    contacts::student stu;
    bool res = stu.ParseFromString(str);
    if(res == false)
    {
        std::cout << "反序列化失败。" << std::endl;
        return -1;
    }

    std::cout << stu.id() << std::endl;
    std::cout << stu.name() << std::endl;
    std::cout << stu.scope() << std::endl;

    return 0;
}